#include "mainwindow.h"
#include "rpi_sensors.h"

gyroscopeWidget::gyroscopeWidget(QObject *parent,rpi_sensor_gyro *a) {
    setupUi(this);
    gyro =a;
    refreshContent();
}

gyroscopeWidget::~gyroscopeWidget() {

}


void gyroscopeWidget::refreshContent() {
    if (!gyro) return;
    th->setText(QString("%1").arg(gyro->currentThetaAngle()));
    ph->setText(QString("%1").arg(gyro->currentPhiAngle()));
    si->setText(QString("%1").arg(gyro->currentSigmaAngle()));

    dthdt->setText(QString("%1").arg(gyro->currentThetaVelocity()));
    dphdt->setText(QString("%1").arg(gyro->currentPhiVelocity()));
    dsidt->setText(QString("%1").arg(gyro->currentSigmaVelocity()));

    dth2dt->setText(QString("%1").arg(gyro->currentThetaAcceleration()));
    dph2dt->setText(QString("%1").arg(gyro->currentPhiAcceleration()));
    dsi2dt->setText(QString("%1").arg(gyro->currentSigmaAcceleration()));

}
